@extends('layouts.app')
@section('title','关于我们')
@section('content')

<!-- start: Content -->
<div class="row-fluid">
	<div class="box span12">
		<div class="box-header">
			<h2><i class="icon-edit"></i>关于我们</h2>
		</div>
		<div class="box-content">
		@if($about == null)
			<form action="{{ URL('app/about') }}" method='POST'  enctype="multipart/form-data" class="form-horizontal" style='height:3000px;'>
				{{ csrf_field() }}
			  <fieldset>
				<div class="control-group">
				  <label class="control-label" for="typeahead">关于我们标题:</label>
				  <div class="controls">
					<input type="text" name='title' class="span6 typeahead" maxlength="15"/>
					<p class="help-block" style='color:red;'>关于我们标题最多可以输入15字!</p>
				  </div>
				</div>
				<div class="control-group hidden-phone">
				  <label class="control-label" for="textarea2">关于我们介绍:</label>
				  <div class="controls">
					<script id="ue-container" style='width:680px;height:300px;' name="content"  type="text/plain"></script>
					<p class="help-block" style='color:red;'>注：图片比例为1：1，图片尺寸为360*360、720*720（参考），图片格式可为JPG，PNG</p>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">联系电话:</label>
				  <div class="controls">
					<input type="text" name='mobile' style='width:300px;' class="span6 typeahead" maxlength="11"/>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">在线QQ:</label>
				  <div class="controls">
					<input type="text" name='QQ' style='width:300px;' class="span6 typeahead" maxlength="12"/>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">客户热线:</label>
				  <div class="controls">
					<input type="text" name='phone' style='width:300px;' class="span6 typeahead" maxlength="11"/>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">公司邮箱:</label>
				  <div class="controls">
					<input type="text" name='email' style='width:300px;' class="span6 typeahead" maxlength="20"/>
				  </div>
				</div>
				<div class="form-actions">
				  <button type="submit" class="btn btn-primary">确定</button>
				</div>
			  </fieldset>
			</form> 
		@else
			<form id='is' action="{{ URL('app/about',$about->id) }}" method='POST' style='display: none;'  enctype="multipart/form-data" class="form-horizontal" style='height:3000px;'>
				{{ csrf_field() }}
				{{ method_field('PUT') }}
			  <fieldset>
				<div class="control-group">
				  <label class="control-label" for="typeahead">关于我们标题:</label>
				  <div class="controls">
					<input type="text" name='title' class="span6 typeahead" maxlength="15" value='{{ $about->title }}'/>
					<p class="help-block" style='color:red;'>关于我们标题最多可以输入15字!</p>
				  </div>
				</div>
				<div class="control-group hidden-phone">
				  <label class="control-label" for="textarea2">关于我们介绍:</label>
				  <div class="controls">
					<script id="ue-container" style='width:680px;height:300px;' name="content"  type="text/plain">{!! $about->content !!}</script>
					<p class="help-block" style='color:red;'>注：图片比例为1：1，图片尺寸为360*360、720*720（参考），图片格式可为JPG，PNG</p>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">联系电话:</label>
				  <div class="controls">
					<input type="text" name='mobile' style='width:300px;' class="span6 typeahead" maxlength="11" value='{{ $about->mobile }}'/>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">在线QQ:</label>
				  <div class="controls">
					<input type="text" name='QQ' style='width:300px;' class="span6 typeahead" maxlength="12" value='{{ $about->QQ }}'/>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">客户热线:</label>
				  <div class="controls">
					<input type="text" name='phone' style='width:300px;' class="span6 typeahead" maxlength="11" value='{{ $about->phone }}'/>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">公司邮箱:</label>
				  <div class="controls">
					<input type="text" name='email' style='width:300px;' class="span6 typeahead" maxlength="20" value='{{ $about->email }}'/>
				  </div>
				</div>
				<div class="form-actions">
				  <button type="submit" class="btn btn-primary">确定</button>
				  <span class="btn btn-danger" onclick="guanbi(this)">取消</button>
				</div>
			  </fieldset>
			</form> 

			<form id='this' enctype="multipart/form-data" class="form-horizontal" style='height:3000px;'>
			  <fieldset>
				<div class="control-group">
				  <label class="control-label" for="typeahead">关于我们标题:&nbsp;&nbsp;</label>
				  <div class="controls">
				  	<input class="input-xlarge focused" id="focusedInput" type="text" value="{{ $about->title }}" readonly />
				  </div>
				</div>
				<div class="control-group hidden-phone">
				  <label class="control-label" for="textarea2">关于我们介绍:</label>
				  <div class="controls">
					{!! $about->content !!}
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">联系电话:&nbsp;&nbsp;</label>
				  <div class="controls">
					<input class="input-xlarge focused" id="focusedInput" type="text" value="{{ $about->mobile }}"  readonly/>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">在线QQ:&nbsp;&nbsp;</label>
				  <div class="controls">
					<input class="input-xlarge focused" id="focusedInput" type="text" value="{{ $about->QQ }}"  readonly/>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">客户热线:&nbsp;&nbsp;</label>
				  <div class="controls">
				  	<input class="input-xlarge focused" id="focusedInput" type="text" value="{{ $about->phone }}"  readonly/>
				  </div>
				</div>
				<div class="control-group">
				  <label class="control-label" for="typeahead">公司邮箱:&nbsp;&nbsp;</label>
				  <div class="controls">
				  	<input class="input-xlarge focused" id="focusedInput" type="text" value="{{ $about->email }}"  readonly/>
				  </div>
				</div>
				<div class="form-actions">
				  <span class="btn btn-primary" onclick="edit(this)">编辑</span>
				</div>
			  </fieldset>
			</form> 
		@endif  
		</div>
	</div><!--/span-->
</div><!--/row-->
<!-- end: Content -->
<script type="text/javascript">
    var ue = UE.getEditor('ue-container');
    ue.ready(function(){
        ue.execCommand('serverparam', '_token', '{{ csrf_token() }}');
    });
</script>
@stop
<script type="text/javascript">
		
		function edit(o){

			document.getElementById("is").style.display = '';
			document.getElementById("this").style.display = 'none';

		}

		function guanbi(o){
			document.getElementById("this").style.display = '';
			document.getElementById("is").style.display = 'none';
			
		}
</script>